package com.olympus.hermes.product.bean.dto.product;

import com.olympus.hermes.common.bean.AbstractBeanConvert;
import com.olympus.hermes.product.domain.Product;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author Mickey
 * @since 2021/2/5
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class CreateProductDTO extends AbstractBeanConvert<CreateProductDTO, Product> {

    @NotBlank
    private String name;

    private Long brandId;

    @NotNull(message = "分类id不能为空")
    private Long categoryId;

    @Override
    protected Product doForward(CreateProductDTO createProductDTO) {
        Product product = new Product();
        product.setName(createProductDTO.getName());
        return product;
    }

    @Override
    protected CreateProductDTO doBackward(Product product) {
        return null;
    }
}
